<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>修改个人信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <link rel="stylesheet" href="../css/mui.min.css">
    <script src="../js/mui.min.js"></script>
    <script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/getUrlParam.js"></script>
    <style>
        input{
            width: 75%!important;
            font-size: 12px!important;
        }
        label{
            width: 23%!important;
            font-size: 12px!important;
            font-family:Microsoft YaHei,sans-serif;
            font-weight: normal;
        }
        label span{

            display:inline-block;
            vertical-align:middle;

        }
    </style>
</head>
<div class="mui-content" >
    <div class="headage"></div>
    <div class="mui-content-padded" >
        <img src="../images/qyqb.png" style="width:100%;text-align: center;height: 120px;"/>
    </div>

    <div class="container">
        <form class="mui-input-group">
            <div class="mui-input-row ">
                <label>真实姓名:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="username">
            </div>
            <div class="mui-input-row ">
                <label>联系电话:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="phone">
            </div>
            <div class="mui-input-row ">
                <label>地址:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="address">
            </div>

        </form>

        <div style="width: 100%;">
            <button type="button" class="mui-btn mui-btn-primary" id="saveUpload"  style="width: 80%;height: 35px;float: left;margin-left: 10%;margin-top: 20px;">确认修改</button>

        </div>
    </div>

    <div class="footerpage">
    </div>
</div>
</body>


<script>
    $(function(){

        /*公共部分
         * 导航栏
         * footer CopyRight
         */

        $(".headage").load("head.html");
        $(".footerpage").load("footer.html");
        $("#titletxt").html("修改个人信息");
        var  userid=getCookie('userid');
        if (userid==null||userid==undefined)
        {
            geturlid();
        }else {
            $("#saveUpload").click(function () {

                var phone = $("#phone").val();
                var address = $("#address").val();
                var username = $("#username").val();
                if (username == "" || username == undefined) {
                    mui.toast('请输入你的真实姓名！');
                    return;
                }
                if (phone == "" || phone == undefined) {
                    mui.toast('请输入你的联系电话！');
                    return;
                } else {
                    var t = Isphone(phone);
                    if (t == false) {
                        mui.toast('联系电话格式不对！');
                        return;
                    }
                }
                if (address == "" || address == undefined) {
                    mui.toast('请输入你的联系地址！');
                    return;
                }
                mui.post('/User/update',
                    {
                        username: username,
                        mobile: phone,
                        address: address,
                        userid: userid
                    },
                    function (data) {
                        console.log(data);
                        if (data.code) {
                            mui.toast('资料提交成功...');
                            setCookie('mobile', phone);
                            setCookie('username', username);
                            setCookie('address', address);
                        window.location.href=topath()+"view/user.html";
                        }
                    }, 'json'
                )
            });
        }
    });
</script>

